import greenfoot.*;  // (Actor, World, Greenfoot, GreenfootImage)

public class CrabWorld extends World
{
 /**
     * Create the crab world (the beach). Our world has a size 
     * of 560x560 cells, where every cell is just 1 pixel.
     */
    public CrabWorld() 
 {
        super(560, 560, 1);
        Crab c = new Crab();
        addObject(c,250,500);
        for(int i =0;i<=10;i++){
            Worm w =new Worm();
            addObject(w,50+i*25,50*2*i);
        }
        
        for(int i =0;i<2;i++){
          Lobster l = new Lobster();
          addObject(l,200+50*i,100*i);
        }
 }
    
 public void drawNum(int num){
        GreenfootImage image = getBackground();
        Font font = new Font(40);
        Color color = new Color(255,192,203);
        image.setColor(color);
        image.setFont(font);
        image.drawString("吃虫数: "+num,350,520);
        if(num>=4){ 
            for(int i=0;i<4;i++)
            {
            image.drawString("成功！",200,200);
            }
        }
 }
   
 public void lose(){
     GreenfootImage image = getBackground();
     Font font = new Font(40);
     Color color = new Color(128,0,128);
     image.setColor(color);
     image.setFont(font);
     image.drawString("失败！",200,200);
     Greenfoot.stop();
    }
}